﻿$(function () {
    $("#imgfile1").change(function (evt) {
        var files = evt.originalEvent.target.files;
        var reader = new FileReader();
        reader.onload = function (aimg) {
            var imgresult = aimg.target.result;
            var img = document.createElement("img");
            img.src = imgresult;
            $("#imginfo").append(img);
        };
        reader.readAsDataURL(files[0]);
    });

    $("#txtfile1").change(function (evt) {
        var files = evt.originalEvent.target.files;
        var reader = new FileReader();
        reader.onload = function (aimg) {
            var txtresult = aimg.target.result;
            var fmtxt = txtresult.replace(/\n/g, "<br />");
            $("#txtcontent").html(fmtxt);
        };
        reader.readAsText(files[0]);
    });
});